package com.wwwarehouse.taskcenter.fragment.job_point.step5;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import com.wwwarehouse.common.activity.base.BaseFragment;
import com.wwwarehouse.taskcenter.R;

/**
 * @创建者 chenchao.
 * @创建时间 2017/10/25 21:19
 * @描述 ${TODO}
 */

public class ChooseJobUnitAddItemBytwoWayFragment extends BaseFragment {

    private View mView;
    private RelativeLayout mAddPointStep5TwowayAlladdRel;
    private RelativeLayout mAddPointStep5TwowayAllbyitemRel;
    private String jobPointUkid,warehouseUkid;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        mView = inflater.inflate(R.layout.fragment_choose_add_way_step5, container, false);
        initView(mView);
        return mView;
    }

    @Override
    public void setTitle() {
        if (peekFragment() instanceof ChooseJobUnitAddItemBytwoWayFragment) {
            mActivity.setTitle("" + getString(R.string.choose_add_type));
        }
    }

    @Override
    public void requestDatas() {

    }

    private void initView(View mView) {
        jobPointUkid = getArguments().getString("jobPointUkid");
        warehouseUkid = getArguments().getString("warehouseUkid");

        mAddPointStep5TwowayAlladdRel = (RelativeLayout) mView.findViewById(R.id.add_point_step5_twoway_alladd_rel);
        mAddPointStep5TwowayAllbyitemRel = (RelativeLayout) mView.findViewById(R.id.add_point_step5_twoway_allbyitem_rel);

        mAddPointStep5TwowayAlladdRel.setOnClickListener(new View.OnClickListener() {//直接可以完成的
            @Override
            public void onClick(View v) {
                //按名称
                Bundle bundle = new Bundle();
                bundle.putString("jobPointUkid",jobPointUkid);
                bundle.putString("warehouseUkid",warehouseUkid);
                ChooseJobUnitAllMessagePagerFragment5 fragment5 = new ChooseJobUnitAllMessagePagerFragment5();
                fragment5.setArguments(bundle);
                pushFragment(fragment5);
            }
        });

        mAddPointStep5TwowayAllbyitemRel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //按类目添加
                Bundle bundle = new Bundle();
                bundle.putString("jobPointUkid",jobPointUkid);
                bundle.putString("warehouseUkid",warehouseUkid);
                ChooseJobUnitpagerFragment5 fragment5 = new ChooseJobUnitpagerFragment5();
                fragment5.setArguments(bundle);
                pushFragment(fragment5);
            }
        });
    }
}
